package com.gzy.fisherybackend;

import java.io.File;

import org.mybatis.spring.annotation.MapperScan;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;

@SpringBootApplication
@MapperScan("com.gzy.fisherybackend.mapper")
public class FisheryBackendApplication {

    static {
        // 解决Windows环境下缺少HADOOP_HOME环境变量的问题
        // 使用当前用户目录作为Hadoop主目录的绝对路径
        String userDir = System.getProperty("user.dir");
        File hadoopHome = new File(userDir, "hadoop_home");
        if (!hadoopHome.exists()) {
            hadoopHome.mkdirs();
        }
        
        System.setProperty("hadoop.home.dir", hadoopHome.getAbsolutePath());
        System.setProperty("io.native.lib.available", "false");
        System.out.println("Hadoop home directory: " + hadoopHome.getAbsolutePath());
    }

    public static void main(String[] args) {
        SpringApplication.run(FisheryBackendApplication.class, args);
    }

}
